/**
 * 玩家信息组件
 */
var PlayerInfoUnit = Unit.extend({
    _ccsFileName: res.PlayerInfoUnit_json,
    refreshData:function(){
       this._initInfo();
    },
    /**
     * 初始化玩家信息
     * @protected
     */
    _initInfo: function () {
        this._nodeList['txtName'].setString(ellipsisStr(gameData.nickname, 6));
        this._nodeList['txtID_id'].setString(gameData.uid);
        this._setHeadSprite();
        if (window.inBanShu) {
            safeHide(this._nodeList['txtID']);
            safeHide(this._nodeList['txtID_id']);
            safeShow(this._nodeList['txtLV']);
            safeShow(this._nodeList['txtID_lv']);
            safeString(this._nodeList['txtID_lv'], '1');
        } else {
            safeHide(this._nodeList['txtLV']);
            safeHide(this._nodeList['txtID_lv']);
        }
    },
    /**
     * 设置玩家头像
     * @private
     */
    _setHeadSprite: function () {
        loadImageToSprite(gameData.headimgurl, this._nodeList['head']);
    },
    /**
     * 点击事件
     * @private
     */
    _initClickListeners: function () {
        this._super();
        this._clickListeners = {};
        if (!window.inReview && !window.inBanShu) {
            this._clickListeners['head'] = '_clickHead';
        }
    },
    /**
     * 点击头像
     * @private
     */
    _clickHead: function () {
        if (window.inReview) {
            return;
        }
        showWindow('PlayerInfoCommonWindow');
    }
});